package com.ouc.yyi.springcloud.card.cardInfo.cotroller;

import com.ouc.yyi.springcloud.card.cardInfo.bo.CardBo;
import com.ouc.yyi.springcloud.card.cardInfo.sevice.CardInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletRequest;
import java.util.Map;

@RestController
@RequestMapping("/card")
public class CardController {

    @Autowired
    private CardInfoService cardInfoService;

    @Autowired
    private HttpServletRequest request;

    @PostMapping(value = "/info")
    public CardBo getUserInfoById(@RequestBody Map<String, Object> map) {
        String mobile = (String) map.get("mobile");
        CardBo userInfoById = cardInfoService.getCardInfoByMobile(mobile);
        System.err.println(userInfoById);
        return userInfoById;
    }

    @GetMapping(value = "/gateway")
    public String getTest() {
        return request.getHeader("sessionId");
    }

    @GetMapping(value = "/hello")
    public String hello(@RequestParam("info") String hello) {
        return hello;
    }

    @GetMapping(value = "/des")
    public String getCardBo(@RequestBody CardBo cardBO) {
        System.err.println(cardBO);
        return "2222";

    }




}
